﻿using Learn.Infraestrutura.Dto.Response;
using System;
using System.Collections.Generic;
using System.Text;

namespace Learn.Service.Instance
{
    public abstract class Base_Service
    {
        public Api_Result Result(int result, string message = "", object data = null)
        {
            Api_Code code = Api_Code.ok;
            if (result <= 0)
            {
                code = Api_Code.fail;
            }
            string msg = result > 0 ? "操作成功" : "操作失败";
            if (!string.IsNullOrEmpty(message))
            {
                msg = message;
            }
            return new Api_Result()
            {
                code = code,
                message = msg,
                data = data
            };
        }
        }
}
